package com.mifengkong.cygtools.model;

import android.app.Activity;

import com.mifengkong.cygtools.dialog.LoadingDialog;
import com.mifengkong.frtools.http.request.progress.ProgressDialogHandler;
import com.mifengkong.frtools.util.FRString;

/**
 *
 * @author jiangyongxing
 * @date 2018/6/29
 * 描述：
 */

public class APPProgressDialogHandler extends ProgressDialogHandler {

    public APPProgressDialogHandler(Activity context) {
        super(context);
    }


    @Override
    protected void initProgressDialog(String title) {
        if (null == context) {
            throw new IllegalStateException("activity should not be null");
        }
        if (pd == null && !context.isFinishing()) {
            if (FRString.isEmpty(title)) {
                title = "加载中,请稍候....";
            }
            pd = new LoadingDialog.Builder(context).setMessage(title).create();
            pd.setCancelable(true);
            pd.setCanceledOnTouchOutside(false);
            if (null != pd && !pd.isShowing()) {
                pd.show();
            }
        }
    }
}
